#include "keywordType.h"
#include "IVisitor.h"

keywordType::keywordType(const NameTokPtr& arg, const exprTypePtr& value, bool afterstarargs, int nodeId):
    SimpleNode(nodeId),
    _arg(arg),
    _value(value),
    _afterstarargs(afterstarargs)
{
}
    
keywordType::~keywordType()
{
    
}
    
Ast::AstTypes keywordType::type() const
{
    return Ast::keywordType;
}
    

NameTokPtr keywordType::arg()
{
    return _arg;
}

void keywordType::setArg(const NameTokPtr& arg)
{
    _arg = arg;
}

exprTypePtr keywordType::value()
{
    return _value;
}

void keywordType::setValue(const exprTypePtr& value)
{
    _value = value;
}

bool keywordType::afterstarargs()
{
    return _afterstarargs;
}

void keywordType::setAfterstarargs(bool afterstarargs)
{
    _afterstarargs = afterstarargs;
}

    
QString keywordType::toString() const
{
    return QString("keywordType[arg=%1, value=%2, afterstarargs=%3]").
                arg(_arg ? _arg->toString():"").
                arg(_value ? _value->toString():"").
                arg(_afterstarargs);
}
    
void keywordType::accept(IVisitor* visitor, const SimpleNodePtr& node)
{
    traverse(visitor);
}
    
void keywordType::traverse(IVisitor* visitor)
{
    if (_arg != NULL)
        _arg->accept(visitor, _arg);
    if (_value != NULL)
        _value->accept(visitor, _value);
}